﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jayden.Dll.Core.Persistence;
using Jayden.Dll.Entities.Enums;
using Jayden.Dll.Core.Persistence.Attributes;

namespace Jayden.Dll.Entities.Common
{
	[Table]
	public class Product : ObjectBase, IComparable<Product>
	{
		private int m_OrderIndex;
		private string m_Category;
		private string m_Reference;
		private string m_Label;
		private float m_Price;
		private string m_Image;
		private string m_Thumbnail;
		private ProductStatusType m_StatusType;

		public Product(UnitOfWork uow) : base(uow, 0) { }

		[Field(PrimaryKey = true, AutoIncrement = true)]
		public long ProductId { get { return (long)ObjectId[0]; } set { ObjectId[0] = value; } }
		[Field]
		public int OrderIndex { get { return m_OrderIndex; } set { m_OrderIndex = value; } }
		[Field]
		public string Category { get { return m_Category; } set { m_Category = value; } }
		[Field(Unique=true)]
		public string Reference { get { return m_Reference; } set { m_Reference = value; } }
		[Field]
		public string Label { get { return m_Label; } set { m_Label = value; } }
		[Field]
		public float Price { get { return m_Price; } set { m_Price = value; } }
		[Field]
		public string Image { get { return m_Image; } set { m_Image = value; } }
		[Field]
		public string Thumbnail { get { return m_Thumbnail; } set { m_Thumbnail = value; } }
		[Field]
		public ProductStatusType StatusType { get { return m_StatusType; } set { m_StatusType = value; } }

		public int CompareTo(Product other)
		{
			return m_OrderIndex.CompareTo(other.m_OrderIndex);
		}
	}
}
